package com.yxjx.duoxue.datamodel.config;

import org.json.JSONException;
import org.json.JSONObject;

import com.yxjx.duoxue.utils.UIHelper;

public class ConfigRefundReasonDTS implements java.io.Serializable {

    /**
	 * 
	 */
	private static final long serialVersionUID = 8345896446116402136L;
	private Integer id;
    private String reasonName;
    private String reasonDes;
    private Integer reasonStatus;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getReasonName() {
        return reasonName;
    }

    public void setReasonName(String reasonName) {
        this.reasonName = reasonName;
    }

    public String getReasonDes() {
        return reasonDes;
    }

    public void setReasonDes(String reasonDes) {
        this.reasonDes = reasonDes;
    }

    public Integer getReasonStatus() {
        return reasonStatus;
    }

    public void setReasonStatus(Integer reasonStatus) {
        this.reasonStatus = reasonStatus;
    }

    @Override
    public String toString() {
        return "{\"id\":\"" + id + "\", \"reasonName\":\"" + reasonName + "\", \"reasonDes\":\"" + reasonDes + "\", \"reasonStatus\":\"" + reasonStatus + "\"}";
    }
    
    public static ConfigRefundReasonDTS from(String str) {
    	if (UIHelper.isEmpty(str)) {
    		return null;
    	}
    	try {
    		ConfigRefundReasonDTS reason = new ConfigRefundReasonDTS();
			JSONObject jo = new JSONObject(str);
			reason.setId((Integer) jo.get("id"));
		    reason.setReasonName((String) jo.get("reasonName"));
		    reason.setReasonDes((String) jo.get("reasonDes"));
		    reason.setReasonStatus((Integer) jo.get("reasonStatus"));
		    return reason;
		} catch (JSONException e) {
			e.printStackTrace();
		}
    	return null;
    }
}